<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>
      弹性布局-上下对齐内容(flex layout - up and down align content)
    </title>
    <!-- 
    在CSS的flex布局中，align-content属性用于设置多根轴线（多行）在交叉轴方向上的对齐方式。
    align-content属性的文字说明： 
 
      1. flex-start：默认值，多根轴线在交叉轴起点对齐。 
      2. flex-end：多根轴线在交叉轴末尾对齐。 
      3. center：多根轴线在交叉轴居中对齐。 
      4. space-between：多根轴线均匀分布在交叉轴上，首尾轴线与容器边缘对齐，轴线之间的间距相等。 
      5. space-around：多根轴线均匀分布在交叉轴上，轴线之间及首尾轴线与容器边缘之间的间距相等。 
   -->
    <style>
      .container {
        display: flex;
        flex-wrap: wrap;
        background-color: skyblue;
        width: 400px;
        height: 200px;
      }

      .item {
        width: 80px;
        height: 80px;
      }
    </style>
    <style>
      /* flex-start - 多根轴线在交叉轴起点对齐 */
      .display-flex-align-content-flex-start {
        align-content: flex-start;
      }

      /* flex-end - 多根轴线在交叉轴末尾对齐 */
      .display-flex-align-content-flex-end {
        align-content: flex-end;
      }

      /* center - 多根轴线在交叉轴居中对齐 */
      .display-flex-align-content-center {
        align-content: center;
      }

      /* space-between - 多根轴线均匀分布在交叉轴上，首尾轴线与容器边缘对齐，轴线之间的间距相等 */
      .display-flex-align-content-space-between {
        align-content: space-between;
      }

      /* space-around - 多根轴线均匀分布在交叉轴上，轴线之间及首尾轴线与容器边缘之间的间 */
      .display-flex-align-content-space-around {
        align-content: space-around;
      }

      /* （默认值）：与 align-items 的 stretch */
      .display-flex-align-content-stretch {
        align-content: stretch;
      }
    </style>
  </head>
  <body>
    <h3>1. align-content: flex-start - 多根轴线在交叉轴起点对齐</h3>
    <div class="container display-flex-align-content-flex-start">
      <div class="item item1">1</div>
      <div class="item item2">2</div>
      <div class="item item3">3</div>
      <div class="item item4">4</div>
      <div class="item item1">1</div>
      <div class="item item2">2</div>
      <div class="item item3">3</div>
      <div class="item item4">4</div>
    </div>

    <h3>2. align-content: flex-end - 多根轴线在交叉轴末尾对齐</h3>
    <div class="container display-flex-align-content-flex-end">
      <div class="item item1">1</div>
      <div class="item item2">2</div>
      <div class="item item3">3</div>
      <div class="item item4">4</div>
      <div class="item item1">1</div>
      <div class="item item2">2</div>
      <div class="item item3">3</div>
      <div class="item item4">4</div>
    </div>

    <h3>3. align-content: center - 多根轴线在交叉轴居中对齐</h3>
    <div class="container display-flex-align-content-center">
      <div class="item item1">1</div>
      <div class="item item2">2</div>
      <div class="item item3">3</div>
      <div class="item item4">4</div>
      <div class="item item1">1</div>
      <div class="item item2">2</div>
      <div class="item item3">3</div>
      <div class="item item4">4</div>
    </div>

    <h3>4. align-content: space-between - flex项目在基线对齐</h3>
    <div class="container display-flex-align-content-space-between">
      <div class="item item1">1</div>
      <div class="item item2">2</div>
      <div class="item item3">3</div>
      <div class="item item4">4</div>
      <div class="item item1">1</div>
      <div class="item item2">2</div>
      <div class="item item3">3</div>
      <div class="item item4">4</div>
    </div>

    <h3>
      5. align-content: space-around -
      多根轴线均匀分布在交叉轴上，轴线之间及首尾轴线与容器边缘之间的间
    </h3>
    <div class="container display-flex-align-content-space-around">
      <div class="item item1">1</div>
      <div class="item item2">2</div>
      <div class="item item3">3</div>
      <div class="item item4">4</div>
      <div class="item item1">1</div>
      <div class="item item2">2</div>
      <div class="item item3">3</div>
      <div class="item item4">4</div>
    </div>

    <h3>
      6. align-content: stretch - stretch（默认值）：与 align-items 的 stretch
      类似
    </h3>
    <div class="container display-flex-align-content-stretch">
      <div class="item item1">1</div>
      <div class="item item2">2</div>
      <div class="item item3">3</div>
      <div class="item item4">4</div>
      <div class="item item1">1</div>
      <div class="item item2">2</div>
      <div class="item item3">3</div>
      <div class="item item4">4</div>
    </div>

    <script src="./js/itemRandomColor.js"></script>
  </body>
</html>
